import requset from '../utils/request'

//请求参数接口
export interface CateListModel{
    timestamp:number,
    categoryId:number,
    subCategoryId:number,
    categoryType?:number|undefined
}
//返回值之导航栏
export interface CategoryL2ListModel{
    id:number
    frontDesc:string,
    frontName:string,
    name:string,
    showIndex:number,
    superCategoryId:number,
    [propsName:string]:any
}
//返回值之categoryL1
export interface categoryL1Model{
    [propsname:string]:any
}
//返回值之列表循环渲染
export interface CategoryItemsModel{
    category:CategoryL2ListModel,
    itemIdList:null,
    itemList:bannerListModel[]
}
//返回值之循环项
export interface bannerListModel{
    counterPrice:number,
    displaySkuId:number,
    id:number,
    listPicUrl:string,
    name:string,
    pieceUnitDesc:string,
    topLogo:toplogoModel,
    preLogo:toplogoModel[],
    [propsname:string]:any
}
//topLogo
export interface toplogoModel{
    height:number
    type:number,
    width:number,
    logoUrl:string
}

//返回值
export interface getCateListModel{
    data:{
        data:{
            categoryItems:CategoryItemsModel,
        categoryL1:categoryL1Model
        categoryL2List:CategoryL2ListModel[]
        }
    }
}


export const getCateList=(params:CateListModel)=>{
    return requset.get<any,getCateListModel>(`item/list.json?__timestamp=${params.timestamp}&categoryId=${params.categoryId}&subCategoryId=${params.subCategoryId}&categoryType=${params.categoryType}`)
}
